package com.stylefeng.guns.modular.flagglory.service.impl;

import com.stylefeng.guns.common.persistence.model.QuestionCategory;
import com.stylefeng.guns.common.persistence.dao.QuestionCategoryMapper;
import com.stylefeng.guns.core.node.ZTreeNode;
import com.stylefeng.guns.modular.flagglory.dao.QuestionCategoryDao;
import com.stylefeng.guns.modular.flagglory.service.IQuestionCategoryService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * lg_题库分类 服务实现类
 * </p>
 *
 * @author xin123
 * @since 2018-01-30
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class QuestionCategoryServiceImpl extends ServiceImpl<QuestionCategoryMapper, QuestionCategory> implements IQuestionCategoryService {
    @Autowired
    private QuestionCategoryDao questionCategoryDao;

    @Override
    public List<ZTreeNode> tree() {
        List<ZTreeNode> tree = questionCategoryDao.tree();
        ZTreeNode zTreeNode = new ZTreeNode();
        zTreeNode.setName("顶级");
        zTreeNode.setId(0L);
        tree.add(zTreeNode);
        return tree;
    }
}
